﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Interfleet.SE.UICompiler.Core
{
    /// <summary>
    /// <para>
    /// Arguments for the compiler.
    /// </para>
    /// <para>
    /// This class should normally (as long as we follow the factory pattern) not
    /// be created outside the <see cref="CompileAgentFactory"/>.
    /// </para>
    /// <example>
    /// <para>Typical use:</para>
    /// <code>
    /// var agentFactory = CompileAgentFactory.CreateAgentFactory(CompileType.YUICompressorJavaScript);
    /// var arguments = agentFactory.CreateArguments();
    /// 
    /// arguments.Files.Add("c:\\input.js");
    /// arguments.Files.Add("c:\\input2.js");
    /// arguments.CompiledFileName = "c:\\output.js";
    /// 
    /// var compilerAgent = agentFactory.CreateCompilerAgent(arguments);
    /// var result = compilerAgent.Compile();
    /// </code>
    /// </example>
    /// </summary>
    public abstract class Arguments
    {
        /// <summary>
        /// If the property CompileTimeout is not set, this will be the default value in
        /// milliseconds.
        /// </summary>
        public const int DefaultCompileTimeout = 5000;

        /// <summary>
        /// Constructor
        /// </summary>
        public Arguments()
        {
            Files = new List<string>();
        }

        /// <summary>
        /// Full path of javascript files that should be compiled
        /// </summary>
        public virtual List<string> Files
        {
            get;
            private set;
        }

        /// <summary>
        /// Full path of the output file.
        /// </summary>
        public virtual string CompiledFileName
        {
            get;
            set;
        }

        /// <summary>
        /// Option for the compiler.
        /// </summary>
        public virtual string CompileOption
        {
            get;
            set;
        }

        /// <summary>
        /// Compile timeout in milliseconds.
        /// </summary>
        public virtual int? CompileTimeout
        {
            get;
            set;
        }

        /// <summary>
        /// Compile type
        /// </summary>
        public abstract CompileType CompileType
        {
            get;
        }
    }
}
